using System;
using Microsoft.VisualStudio.Profiler;

namespace CoverageRunner
{
    public class ProfilerRunner : IDisposable
    {
        public ProfilerRunner()
        {
            StartProfiler();
        }

        public void Dispose()
        {
            StopProfiler();
        }

        private static void StopProfiler()
        {
            DataCollection.StopProfile(
                ProfileLevel.Global,
                DataCollection.CurrentId);
        }

        private static void StartProfiler()
        {
            DataCollection.StartProfile(
                ProfileLevel.Global,
                DataCollection.CurrentId);
        }
    }
}